﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.DTO
{
    public class URL
    {


        //public const String 接口url = "http://192.168.3.33:8090";
        //public const String 图片url = "http://192.168.3.33:4545";
        //public const String 接口url = "http://localhost:8090";
        public const String 接口url = "http://175.170.138.171:8090";
        public const String 图片url = "http://175.170.138.171:4545";
        public const String 面料图片路径 = "/material/";
        public const String 备注图片路径 = "/memo/";
        public const String 款式图片路径 = "/style/";
    }
    public class DTO样衣下单
    {

    }
    public class AccessoryItemDTO
    {
        public String id { get; set; }
        public String code { get; set; }  //  项目编码
        public String name { get; set; }    //  项目名称
        public AccessoryItemDTO(string id, string code, string name)
        {
            this.id = id;
            this.code = code;
            this.name = name;
        }
    }
    /// <summary>
    /// 辅料信息dto
    /// </summary>
    public class ContrastsDTO
    {

        public String create_date { get; set; }
        public String delete_flag { get; set; }
        public String material_category { get; set; }
        public String material_code { get; set; }//code
        public String material_color { get; set; }
        public String material_composition { get; set; }
        public String material_gram_weight { get; set; }
        public String material_id { get; set; }
        public String material_name_cn { get; set; }//name
        public String material_other1 { get; set; }
        public String material_other3 { get; set; }
        public String material_other4 { get; set; }
        public String material_sample { get; set; }
        public String material_season { get; set; }
        public String material_source { get; set; }
        public String material_spec { get; set; }
        public String material_spec_unit_cd { get; set; }
        public String material_style { get; set; }
        public String material_thread_count { get; set; }
        public String material_unit_cd { get; set; }
        public String material_weave { get; set; }
        public String material_year { get; set; }
        public String remarks { get; set; }
    }

    /// <summary>
    /// 绑定数据源使用Dto
    /// </summary>
    public class ContrastForUCDto
    {
        public String id { get; set; }
        public String code { get; set; }  //  设计点类型编码
        public String name { get; set; }    //  设计点类型名称
        public List<DtoForChooseContrasts> DtoForChooseContrasts { get => dtoForChooseContrasts; set => dtoForChooseContrasts = value; }

        private List<DtoForChooseContrasts> dtoForChooseContrasts = new List<DtoForChooseContrasts>();

        public ContrastForUCDto()
        {

        }
        public ContrastForUCDto(AccessoryItemDTO accessoryItemDTO, List<DtoForChooseContrasts> dtoForChooseContrasts)
        {
            this.id = accessoryItemDTO.id;
            this.code = accessoryItemDTO.code;
            this.name = accessoryItemDTO.name;
            this.DtoForChooseContrasts = dtoForChooseContrasts;
        }
    }
    /// <summary>
    /// 选择的辅料
    /// </summary>
    public class DtoForChooseContrasts
    {
        public String material_id;
        private String material_code;
        private String material_name_cn;
        private String material_spec;//规格
        private String material_location;//位置
        public String partId;//位置id
        private String count;//单耗
        
        public DtoForChooseContrasts(string material_id, string material_code, string material_name_cn, String partId, string material_location, string count,string material_spec)
        {
            this.material_id = material_id;
            this.material_code = material_code;
            this.material_name_cn = material_name_cn;
            this.partId = partId;
            this.material_location = material_location;
            this.count = count;
            this.material_spec = material_spec;
        }

        public string 辅料编码 { get => material_code; set => material_code = value; }
        public string 辅料名称 { get => material_name_cn; set => material_name_cn = value; }
        public string 辅料规格 { get => material_spec; set => material_spec = value; }
        public string 辅料位置 { get => material_location; set => material_location = value; }
        public string 辅料单耗 { get => count; set => count = value; }
    }

    /// <summary>
    /// 辅料位置
    /// </summary>
    public class ContrastsLocationDto
    {
        public String id { get; set; }
        public String partName { get; set; }
    }
    /// <summary>
    ///  款式下的辅料选择
    /// </summary>
    public class StyleAccessoryItemsDTO
    {
        public String orderId { get; set; }
        public String styleName { get; set; }    //  款式名称

        public Dictionary<String, List<StyleAccessoryDetailDTO>> styleAccessoryDetails { get; set; } = new Dictionary<string, List<StyleAccessoryDetailDTO>>(); //  款式下辅料定义 K:辅料项目id。

        public StyleAccessoryItemsDTO(String stylename, List<ContrastForUCDto> Dtos)
        {
            this.styleName = stylename;

            foreach(ContrastForUCDto dto in Dtos)
            {
                List<StyleAccessoryDetailDTO> styleAccessoryDetailDTOs = new List<StyleAccessoryDetailDTO>();
                foreach(DtoForChooseContrasts dtoForChoose in dto.DtoForChooseContrasts)
                {
                    styleAccessoryDetailDTOs.Add(new StyleAccessoryDetailDTO(dtoForChoose));
                }
                this.styleAccessoryDetails.Add(dto.id, styleAccessoryDetailDTOs);
            }
        }
        /// <summary>
        /// orderid(保存订单用)
        /// </summary>
        /// <param name="orderid"></param>
        /// <returns></returns>
        public StyleAccessoryItemsDTO buildOrderid(String orderid)
        {
            this.orderId = orderid;
            return this;
        }

        public StyleAccessoryItemsDTO()
        {

        }
    }

    /// <summary>
    /// 款式下的辅料选择
    /// </summary>
    public class StyleAccessoryDetailDTO
    {
        public String materialId { get; set; }  //  辅料id
        public String partId { get; set; }    //  位置id
        public double count { get; set; }    //  单耗

        public StyleAccessoryDetailDTO(DtoForChooseContrasts dtoForChoose)
        {
            this.materialId = dtoForChoose.material_id;
            this.partId = dtoForChoose.partId;
            this.count = Convert.ToDouble(this.count);
        }
    }
}
